<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>宿舍管理系统 - 学生管理</title>
    <link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
    <div class="container">
        <h1>宿舍管理系统</h1>
        <div class="nav">
            <a href="/" class="nav-link active">学生管理</a>
            <a href="/dormitory" class="nav-link">宿舍管理</a>
            <a href="/repair" class="nav-link">维修申请</a>
            <button onclick="showAddForm()">添加学生</button>
        </div>

        <!-- 学生列表 -->
        <div class="content">
            <h2>学生列表</h2>
            <table id="studentTable">
                <thead>
                    <tr>
                        <th>学号</th>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>联系电话</th>
                        <th>宿舍号</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="studentList">
                    <!-- 学生数据将通过JavaScript动态添加 -->
                </tbody>
            </table>
        </div>

        <!-- 添加/编辑学生表单 -->
        <div id="studentForm" class="modal" style="display: none;">
            <div class="modal-content">
                <h2 id="formTitle">添加学生</h2>
                <form id="addEditForm" onsubmit="handleSubmit(event)">
                    <input type="hidden" id="studentId">
                    <div class="form-group">
                        <label for="studentID">学号:</label>
                        <input type="text" id="studentID" required>
                    </div>
                    <div class="form-group">
                        <label for="name">姓名:</label>
                        <input type="text" id="name" required>
                    </div>
                    <div class="form-group">
                        <label for="gender">性别:</label>
                        <select id="gender" required>
                            <option value="男">男</option>
                            <option value="女">女</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="phone">联系电话:</label>
                        <input type="tel" id="phone" required>
                    </div>
                    <div class="form-group">
                        <label for="roomNo">宿舍号:</label>
                        <input type="text" id="roomNo" required>
                    </div>
                    <div class="form-buttons">
                        <button type="submit">保存</button>
                        <button type="button" onclick="hideForm()">取消</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="/static/js/main.js"></script>
</body>
</html>